package net.apexes.demo.codegen.ormlite.column;

import net.apexes.commons.ormlite.Column;
import net.apexes.commons.ormlite.ForeignKey;
import net.apexes.commons.ormlite.Index;
import net.apexes.demo.codegen.ormlite.column.base.QEntityBase;
import net.apexes.demo.codegen.ormlite.entity.ShopStaff;

/**
 * QShopStaff is a ORMLite query type for ShopStaff
 * @see ShopStaff
 */
public class QShopStaff extends QEntityBase<ShopStaff> {

    public static final QShopStaff $ = new QShopStaff("SHOP_STAFF");

    public final Column shopId = field("shopId").columnName("SHOP_ID").varchar(22).notNull().build();

    public final Column accout = field("accout").columnName("ACCOUT").varchar(16).notNull().build();

    public final Column password = field("password").columnName("PASSWORD").varchar(32).notNull().build();

    public class Indexs {

        public final Index constraintIndex24 = index("CONSTRAINT_INDEX_24").column(shopId).build();

        public final Index primaryKey24 = index("PRIMARY_KEY_24").unique().column(id).build();

        public final Index shopIdUsernameUkIndex2 = index("SHOP_ID_USERNAME_UK_INDEX_2").unique().column(shopId).column(accout).build();

    }

    public final Indexs ix = new Indexs();

    public class ForeignKeys {

        public final ForeignKey constraint245 = foreignKey(shopId, "SHOP", "ID");

    }

    public final ForeignKeys fk = new ForeignKeys();

    public QShopStaff(String tableName) {
        super(ShopStaff.class, tableName);
    }

    @Override
    public ShopStaff newInstance() {
        return new ShopStaff();
    }

    @Override
    public Object getFieldValue(ShopStaff instance, String fieldName) {
        switch (fieldName) {
            case "shopId":
                return instance.getShopId();
            case "accout":
                return instance.getAccout();
            case "password":
                return instance.getPassword();
            default:
                return super.getFieldValue(instance, fieldName);
        }
    }

    @Override
    public void setupFieldValue(ShopStaff instance, String fieldName, Object value) {
        switch (fieldName) {
            case "shopId":
                instance.setShopId((java.lang.String) value);
                break;
            case "accout":
                instance.setAccout((java.lang.String) value);
                break;
            case "password":
                instance.setPassword((java.lang.String) value);
                break;
            default:
                super.setupFieldValue(instance, fieldName, value);
                break;
        }
    }

}

